import time


def readfile(fname):
    f = open(fname)
    data = [int(x) for x in f.readlines()]
    return data


def mysorted(a):
    n = len(a)

    for k in range(1, n):
        for i in range(0, n - k):
            if a[i] > a[i+1]:
                a[i], a[i+1] = a[i+1], a[i]
    return a

a = readfile('m1_sorted.txt')
t_start = time.time()
mysorted(a)
t_finish = time.time()
print('m1_sorted', round((t_finish - t_start) * 1000), 'milliseconds')


b = readfile('m2_reverse.txt')
t_start = time.time()
mysorted(a)
t_finish = time.time()
print('m2_reverse', round((t_finish - t_start) * 1000), 'milliseconds')


y = readfile('m3_shuffle.txt')
t_start = time.time()
mysorted(a)
t_finish = time.time()
print('m3_shuffle', round((t_finish - t_start) * 1000), 'milliseconds')




